require(['./config'],()=>{
    require(['header','jqc'],()=>{
        class Login {
            constructor () {
                this.login()
            }
            login () {
                $('#btn').on('click',() => {
                    const name=$('#login_user').val()
                    console.log(name)
                    const pwd=$('#login_pwd').val()
                    console.log(pwd)
                    $.get('http://localhost:8080/er-lou/api/user/login.php',{name,pwd},resp=>{
                        console.log(resp)
                        if(resp.code==200){
                            alert('恭喜你登录成功了')
                            $.cookie('name',name,{expires:3,path:'/'})
                            location.replace('/index.html')
                        }else{
                            alert('账号或密码错误')
                        }
                    },'json')
                })
            }
        }
        new Login()
    })
})